var xmlhttp = false;

//check if using IE

try {
	//check jika IE lebih besar dari IE 5
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	//jika tidak menggunakan activeX
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}

//check if not using IE
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	xmlhttp = new XMLHttpRequest();
}

//function request
function makeRequest ( serverPage, objID, msgLoad ) {
	var obj = document.getElementById(objID);
	var msg = msgLoad;
	var t = new Date()
	xmlhttp.open("GET", serverPage+"&t="+t.getTime());
	xmlhttp.onreadystatechange = function() {
		if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
			obj.innerHTML = xmlhttp.responseText;
		} else {
			obj.innerHTML = ""+msg+" <img src = '../class.mamatblog/img/load2.gif'>";
		}
	}
	xmlhttp.send(null);
}

//function sendMessage
function sendMessage ( serverPage, objID, msgLoad,formName,name,email,website,message ) {
	var name = document.forms[formName].elements[name].value;
	var email = document.forms[formName].elements[email].value;
	var message = document.forms[formName].elements[message].value;
	var website = document.forms[formName].elements[website].value;
	var obj = document.getElementById(objID);
	var msg = msgLoad;
	var t = new Date()
	
	xmlhttp.open("GET", serverPage+"name="+name+"&email="+email+"&message="+message+"&website="+website+"&send=1&"+t.getTime());
	xmlhttp.onreadystatechange = function() {
		if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
			obj.innerHTML = xmlhttp.responseText;
		} else {
			obj.innerHTML = ""+msg+" <img src = '../class.mamatblog/img/load2.gif'>";
		}
	}
	xmlhttp.send(null);
}

//function sendMessage
function cekLogin( serverPage, objID, msgLoad,formName,user, pass ) {
	var user = document.forms[formName].elements[user].value;
	var pass = document.forms[formName].elements[pass].value;
	var obj = document.getElementById(objID);
	var msg = msgLoad;
	xmlhttp.open("GET", serverPage+"?user="+user+"&pass="+pass+"");
	xmlhttp.onreadystatechange = function() {
		if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
			obj.innerHTML = xmlhttp.responseText;
		} else {
			obj.innerHTML = ""+msg+" <img src = '../class.mamatblog/img/load2.gif'>";
		}
	}
	xmlhttp.send(null);
}